import Vue from 'vue'
import VueRouter from 'vue-router'
const Home = ()=>import('@/views/home/index.vue')
const resource = ()=>import('@/views/resource/index.vue')
const wxyd = ()=>import('@/views/wxyd/index.vue')
const trs = ()=>import('@/views/trs/index.vue')
const workstation = () =>import('@/views/workstation/index.vue')
const literatureManage = () =>import('@/views/literatureManage/index.vue')
Vue.use(VueRouter)

const routes = [
  {
    path: '/workstation',
    name: 'workstation',
    component: workstation,
    meta:{
      title:'工作台'
    }
  },
  {
    path: '/',
    redirect:'/trs',
    name: 'home',
    component: Home,
    meta:{
      title:'首页'
    }
  },
  {
    path: '/resource',
    name: 'resource',
    component: resource,
    meta:{
      title:'资源'
    }
  },
  {
    path: '/wxyd',
    name: 'wxyd',
    component: wxyd,
    meta:{
      title:'文献研读'
    }
  },
  {
    path: '/trs',
    name: 'trs',
    component: trs,
    meta:{
      title:'文献翻译'
    }
  },
  {
    path: '/literatureManage',
    name: 'literatureManage',
    component: literatureManage,
    meta:{
      title:'文献管理'
    }
  },
  
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})


export default router


// router文件夹-->index.js文件
//cv以下代码解决路由地址重复的报错问题(一劳永逸)
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err)
}
